package com.jm.offer.easy;

/**
 * @Description https://leetcode-cn.com/problems/yuan-quan-zhong-zui-hou-sheng-xia-de-shu-zi-lcof/
 * @date 2022/5/4 7:33
 */
public class _62圆圈中最后剩下的数字 {
    public static void main(String[] args) {

    }

    public static int lastRemaining(int n, int m) {
        int x = 0;
        for (int i = 2; i <= n; i++) {
            x = (x + m) % i;
        }
        return x;
    }

}
